package com.tank.core;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.directwebremoting.annotations.DataTransferObject;

/**
 * 结果类：业务状态和业务数据
 * 
 * @author zhuoyr
 * 
 */
@DataTransferObject
public class TankModel {
	public static TankModel newInstance() {
		return new TankModel();
	}

	public void printData() {
		 for (Object obj : data) {
			 System.out.println(obj);
		 }
	}
	public void printSuccess() {
		 System.out.println("["+this.success+"]:"+this.message);
	}

	/**
	 * 状态
	 */
	private boolean success = true;
	private String message;

	/**
	 * 数据
	 */

	private List data;
	private Map map = new HashMap<String, Object>();

	/**
	 * setter && getter
	 */

	public void setAttribute(String key, Object value) {
		map.put(key, value);
	}

	public void getAttribute(String key) {
		map.get(key);
	}

	// pm.attr.key
	public Map<String, Object> getAttr() {
		return map;
	}

	public List getData() {
		return data;
	}

	public void setData(List data) {
		this.data = data;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

//	public Map<String, Object> getMap() {
//		return map;
//	}
//
//	public void setMap(Map<String, Object> map) {
//		this.map = map;
//	}

}
